package jarvis.services;

import java.util.concurrent.BlockingQueue;
import java.util.concurrent.LinkedBlockingQueue;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;

import org.springframework.stereotype.Service;

@Service
public class ThreadPoolService {
	private ThreadPoolExecutor ex = null;

	public ThreadPoolService() {
		BlockingQueue bq = new LinkedBlockingQueue();
		ex = new ThreadPoolExecutor(10, 20, 1000, TimeUnit.SECONDS, bq);
	}

	public void submit(RunnableTask r) {
		ex.execute(r);
	}

}
